//
//  JSelImgView.m
//  HeadIndustry
//
//  Created by jun on 2017/9/14.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "JSelImgView.h"

@implementation JSelImgView

- (instancetype)initWithFrame:(CGRect)frame tag:(NSInteger)tag
{
    if (self = [super initWithFrame:frame]) {
        self.opaque = NO;
        
        _isBigImg = NO;
        [self configUI:tag];
    }
    return self;
}

- (void)configUI:(NSInteger )tag
{
    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn1.frame = CGRectMake(20 , 20, self.width - 40, self.height - 40);
    [btn1 setImage:[UIImage imageNamed:@"gophone_icon"] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(addBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    btn1.tag = tag;
    [self addSubview:btn1];
    _imgbtn = btn1;
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(self.width - 40, 0, 40, 40);
    [btn setImage:[UIImage imageNamed:@"hui_close"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(closeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    btn.tag = tag;
    [self addSubview:btn];
    _delbtn = btn;
}

- (void)addBtnClick:(UIButton *)btn
{
    if (_addImgBtnBlock) {
        _addImgBtnBlock(btn.tag);
    }
}

- (void)closeBtnClick:(UIButton *)btn
{
    if (_delImgBtnBlock) {
        _delImgBtnBlock(btn.tag);
    }
}

@end
